package com.ticket;

public class sellticket {
    public static void main(String[] args) {
        Windows windows = new Windows();
        Thread t1=new Thread(windows);
        Thread t2=new Thread(windows);
        Thread t3=new Thread(windows);
        t1.start();
        t2.start();
        t3.start();

    }
}

 class Windows implements Runnable{
    private static int ticketnum=100;
    @Override
    public void run() {
        while (ticketnum>=1) {
            ticketnum--;
            System.out.println("剩余票数为" + ticketnum);

            try {
                Thread.sleep(5000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
